/*
 * Copyright (c) 2020. bmy
 * Email：2271608011@qq.com
 * Github：https://github.com/helpcode
 */

import "@pageLess/Home.less";
import { Component } from 'vue-property-decorator';
import HelloWorld from '@components/HelloWorld';
import { HomeLogic } from "@logic/page/home.logic";
import { Getter } from "vuex-class";
import { IndexUtils } from "@utils/index.utils";
import { Autowired } from "@ann/ioc.annotation";
import { VueCustomize, RouterMeta } from "@logic/base.type";
// import { toClass, toInterface, configFilePath } from "json-class-interface";


@Component
export default class Home extends VueCustomize {
  
  public RouterMeta: RouterMeta = {
    title: '首页',
    showNav: true,
    isLogin: true
  }

  @Autowired(Home)
  private logic!: HomeLogic<Home>

  @Autowired()
  public readonly Utils!: IndexUtils;

  @Getter('GettersTabsContentArr')
  public readonly getterFoo!: Array<any>;


  public async created() {
    await this.logic.StartUp();
  }

  public ClickButton(): JSX.Element {
    return (
      <a-button type="primary" onClick={async () => {
        console.log("按钮被点击22222");
      }}>
        Primary
      </a-button>
    )
  }

  public back() {
    console.log("qqqq");
  }


  protected render() {
    return (
      <div class="home">
        <img src="/img/baidu.png" alt="" />
        <h1 on-click={this.back}>111</h1>
        <HelloWorld msg="向HelloWorld props传参" />
        <input type="text" v-model={this.logic.title} />
        <h2>{this.logic.title}</h2>
        {this.ClickButton()}
        <ul>
          {
            this.logic.List.map(v => {
              return <li>
                {v.user_id}
                {v.user_name}
              </li>
            })
          }
        </ul>
      </div>
    )
  }
}
